<!doctype html>
<html>
    
        <meta charset="utf-8">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" > 
        <title>用户登录</title>
        <link rel="stylesheet" type="text/css" href="./weipan/css/pubic.css" />
        <link rel="stylesheet" type="text/css" href="./weipan/css/other.css" />
        <link rel="stylesheet" href="./weipan/css/ui-dialog.css">
        <script src="./weipan/js/jquery-1.7.2.js"></script>
        <script src="./weipan/js/dialog-plus.js" type="text/javascript"></script>

        <script src="./weipan/js/jquery.smsSend.js" type="text/javascript"></script>
        <script src="./weipan/js/base64.js" type="text/javascript"></script>
    </head>

    <body>
        <div class="form_box">
            <!---------- logo内容 ----------> 
            <div class="logo_box">
                <img src="./weipan/images/logo.png">
                <h1>中部微交易系统</h1>
            </div>
<?php
header("Content-type: text/html; charset=utf-8");
// 指定允许其他域名访问  
header('Access-Control-Allow-Origin:*');  
// 响应类型  
header('Access-Control-Allow-Methods:POST');  
// 响应头设置  
header('Access-Control-Allow-Headers:x-requested-with,content-type');
$cookie_file = tempnam('./temp','cookie');
$login_url  = 'http://weipan.zbdzwjy.com/index.php?m=admin&c=index&a=login';
$post_fields = 'loginName=15225669188&password=123456&vcode=&remember=1';
$ch = curl_init($login_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_exec($ch);
curl_close($ch);

$url='http://weipan.zbdzwjy.com/index.php';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255');
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$contents = curl_exec($ch);
preg_match("/<form.*?>([\d|\D|.]*)<\/form>/",$contents,$arr);
print_r($arr[1]);
curl_close($ch);
?>
        </div>
    </body>
    <script>
        $("#okBtn").click(function(){
            $("#okBtn").attr("disabled",true);
            var b = new Base64();

            var loginName = $("#mobile").val();
            var password = b.encode($("#password").val());
            var vcode = $("#vcode").val();
            var remember = $("#remember").prop("checked");
            // var code=$("#code").val();
            remember = remember?1:0;
            $.ajax({
                url:'http://weipan.zbdzwjy.com/index.php?m=admin&c=index&a=login&dosubmit=1',
                type: "post",
                dataType:"json",
                data:{
                    loginName:loginName,
                    password:password,
                    vcode:vcode,
                    remember:remember

                },
                error:function(){
                    $("#okBtn").attr("disabled",false);
                    var d = dialog({
                        title: '提示',
                        content: '网络链接超时，请检查您的网络!',
                        okValue: '确定',
                        ok: function () {}
                    });
                    d.showModal();

                },
                success:function(data){
                    if (data.info == "200"){

                        window.location.href = 'http://weipan.zbdzwjy.com/index.php?m=admin&c=index&a=trade';
                    } else{

                        $("#okBtn").attr("disabled",false);
                        var d = dialog({
                            title: '提示',
                            content: (data.info),
                            okValue: '确定',
                            ok: function () {}
                        });
                        d.showModal();
                    }
                }
            });
        });

        $("input").bind('keypress',function(event){
            if(event.keyCode == "13")
            {
                $('#okBtn').click();
                $("#okBtn").attr("disabled",true);
            }
        });
    </script>
</html>